package com.dxf.sysadmin.controller;

import com.dxf.common.utils.ResultJson;
import com.dxf.sysadmin.entity.EvaluteRecord;
import com.dxf.sysadmin.service.EvaluteRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/record")
@Api(tags  = "EvaluteRecordController|评价记录控制器")
public class EvaluteRecordController {
    @Autowired
    EvaluteRecordService evaluteRecordService;

    @GetMapping("student/{uid}/{tid}")
    @ApiOperation("学生评教生成")
    public ResultJson student(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.student(uid,tid);
    }

    @GetMapping("self/{uid}/{tid}")
    @ApiOperation("教师自评生成")
    public ResultJson selfTeacher(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.selfTeacher(uid,tid);
    }

    @GetMapping("mutual/{uid}/{tid}")
    @ApiOperation("教师互评生成")
    public ResultJson mutualTeacher(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.mutualTeacher(uid,tid);
    }

    @GetMapping("director/{uid}/{tid}")
    @ApiOperation("室主任评教生成")
    public ResultJson director(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.director(uid,tid);
    }

    @GetMapping("department/{uid}/{tid}")
    @ApiOperation("系主任评教生成")
    public ResultJson department(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.department(uid,tid);
    }

    @PostMapping("insert")
    @ApiOperation("评教数据插入")
    public ResultJson insertRecord(@RequestBody List<EvaluteRecord> objList){
        return evaluteRecordService.insertRecord(objList);
    }

    @GetMapping("selfDecide/{uid}/{tid}")
    @ApiOperation("判断教师是否自评")
    public ResultJson selfDecide(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.selfDecide(uid,tid);
    }

    @GetMapping("studentResult/{uid}/{tid}/{cid}/{id}")
    @ApiOperation("学生查看评教记录")
    public ResultJson studentResult(@PathVariable Long uid,@PathVariable Long tid,
                                    @PathVariable Long cid,@PathVariable Long id){
        return evaluteRecordService.studentResult(uid,tid,cid,id);
    }

    @GetMapping("tSelfResult/{uid}/{tid}")
    @ApiOperation("教师自评查看记录")
    public ResultJson tSelfResult(@PathVariable Long uid,@PathVariable Long tid){
        return evaluteRecordService.tSelfResult(uid,tid);
    }

    @GetMapping("tMutualResult/{uid}/{tid}/{id}")
    @ApiOperation("教师互评查看记录")
    public ResultJson tMutualResult(@PathVariable Long uid,@PathVariable Long tid,
                                    @PathVariable Long id){
        return evaluteRecordService.tMutualResult(uid,tid,id);
    }

    @GetMapping("directorResult/{uid}/{tid}/{id}")
    @ApiOperation("室评教查看记录")
    public ResultJson directorResult(@PathVariable Long uid,@PathVariable Long tid,
                                    @PathVariable Long id){
        return evaluteRecordService.directorResult(uid,tid,id);
    }

    @GetMapping("departmentResult/{uid}/{tid}/{id}")
    @ApiOperation("系评教查看记录")
    public ResultJson departmentResult(@PathVariable Long uid,@PathVariable Long tid,
                                     @PathVariable Long id){
        return evaluteRecordService.departmentResult(uid,tid,id);
    }

    @GetMapping("studentSituation/{cid}/{tid}")
    @ApiOperation("班级学生评教情况")
    public ResultJson studentSituation(@PathVariable Long cid,@PathVariable Long tid){
        return evaluteRecordService.studentSituation(cid,tid);
    }

}
